<runtime:VisualPart
	x:Class="SettingsAddIn.SettingsPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:runtime="clr-namespace:ViewOnCore.Visual;assembly=ViewOnCore"
    xmlns:globalProperties="clr-namespace:ViewOnCore.Properties;assembly=ViewOnCore"
    xmlns:properties="clr-namespace:SettingsAddIn.Properties"
	xmlns:control="clr-namespace:UI.Control"
    xmlns:wpf="clr-namespace:ViewOnCore.Helper.WPF;assembly=ViewOnCore">

	<runtime:VisualPart.Resources>

		<Style x:Key="SettingsTabItem" TargetType="{x:Type TabItem}">
			<Setter Property="OverridesDefaultStyle" Value="True" />
			<Setter Property="FocusVisualStyle" Value="{x:Null}" />
			<Setter Property="SnapsToDevicePixels" Value="True" />
			<Setter Property="Foreground" Value="{DynamicResource VOColorText}" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TabItem}">
						<Expander
										Foreground="{TemplateBinding Foreground}"
										IsExpanded="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsSelected, Mode=TwoWay}"
										Header="{TemplateBinding Header}"
										Content="{TemplateBinding Content}">
							<Expander.Template>
								<ControlTemplate TargetType="{x:Type Expander}">
									<Grid x:Name="OuterGrid">
										<Grid.RowDefinitions>
											<RowDefinition Height="30" />
											<RowDefinition Height="Auto" />
										</Grid.RowDefinitions>

										<Border x:Name="Border" Background="#00FFFFFF" ToolTip="{Binding Description}">
											<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="7,0,0,0">
												<TextBlock Margin="30,0,0,0" Text="{TemplateBinding Header}" VerticalAlignment="Center"/>
											</StackPanel>
										</Border>

										<Path
															  SnapsToDevicePixels="True"
															  IsHitTestVisible="False"
															  Name="Arrow"
															  Margin="8,0,8,0"
															  Fill="{DynamicResource VOColorIcon}"
															  RenderTransformOrigin="0.5,0.5"
															  HorizontalAlignment="Left"
															  VerticalAlignment="Center"
															  Data="M 0 0 L 0 8 L 5 4 Z"
															  Stroke="{DynamicResource VOColorIcon}"
															  StrokeThickness="0.5">
											<Path.RenderTransform>
												<RotateTransform Angle="0" />
											</Path.RenderTransform>
										</Path>

										<control:Reveal  x:Name="ContentReveal" Grid.Row="1" VerticalReveal="FromTopToBottom" HorizontalReveal="None">
											<!-- the extra border here is required because Reveal doesn't account for margins -->
											<!--Border HorizontalAlignment="Stretch">
												<Border BorderThickness="0.5,1,0,0" BorderBrush="{DynamicResource VOColor12}" Background="{DynamicResource VOColor14}" CornerRadius="2,3,2,2" HorizontalAlignment="Stretch" SnapsToDevicePixels="True" Margin="7,0,7,6" >
													<Border BorderThickness="0,0,0.5,1" BorderBrush="{DynamicResource VOColor16}" CornerRadius="2,3,2,2" HorizontalAlignment="Stretch" >
														<ContentPresenter x:Name="PART_ContentPresenter" Content="{TemplateBinding Content}" HorizontalAlignment="Stretch" ToolTipService.IsEnabled="False" />
													</Border>
												</Border>
											</Border-->
                                            <ContentPresenter x:Name="PART_ContentPresenter" Content="{TemplateBinding Content}" HorizontalAlignment="Stretch" ToolTipService.IsEnabled="False" />
										</control:Reveal>

									</Grid>
									<ControlTemplate.Triggers>
										<MultiTrigger>
											<MultiTrigger.Conditions>
												<Condition SourceName="Border" Property="IsMouseOver" Value="True" />
												<Condition Property="IsExpanded" Value="False" />
											</MultiTrigger.Conditions>
											<Setter TargetName="Border" Property="Background" Value="{DynamicResource VOColor16}" />
											<Setter TargetName="Border" Property="Cursor" Value="Hand" />
										</MultiTrigger>
										<Trigger Property="IsExpanded" Value="True">
											<Trigger.EnterActions>
												<BeginStoryboard>
													<Storyboard>
														<DoubleAnimation BeginTime="0:0:0"  Storyboard.TargetName="ContentReveal" Storyboard.TargetProperty="AnimationProgress" Duration="0:0:0.2" To="1" DecelerationRatio="1" />
														<DoubleAnimation Storyboard.TargetName="Arrow" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(RotateTransform.Angle)" Duration="0:0:0.2" To="90" DecelerationRatio="1" />
													</Storyboard>
												</BeginStoryboard>
											</Trigger.EnterActions>
											<Trigger.ExitActions>
												<BeginStoryboard>
													<Storyboard>
														<DoubleAnimation Storyboard.TargetName="ContentReveal" Storyboard.TargetProperty="AnimationProgress" Duration="0:0:0.2" AccelerationRatio="1" />
														<DoubleAnimation  Storyboard.TargetName="Arrow" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(RotateTransform.Angle)" Duration="0:0:0.2" AccelerationRatio="1" />
													</Storyboard>
												</BeginStoryboard>
											</Trigger.ExitActions>
										</Trigger>
									</ControlTemplate.Triggers>
								</ControlTemplate>
							</Expander.Template>
						</Expander>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="SettingsTabControl" TargetType="{x:Type TabControl}">
			<Setter Property="OverridesDefaultStyle" Value="True" />
			<Setter Property="FocusVisualStyle" Value="{x:Null}" />
			<Setter Property="SnapsToDevicePixels" Value="True" />
			<Setter Property="ItemContainerStyle" Value="{StaticResource SettingsTabItem}" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TabControl}">
						<ScrollViewer
							VerticalScrollBarVisibility="Auto"
							HorizontalScrollBarVisibility="Hidden" >
							<StackPanel IsItemsHost="True" />
						</ScrollViewer>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

	</runtime:VisualPart.Resources>

	<runtime:VisualPart.RenderTransform>
		<TransformGroup>
			<ScaleTransform ScaleX="1" ScaleY="1" />
			<RotateTransform Angle="0" />
			<TranslateTransform X="0" Y="0" />
		</TransformGroup>
	</runtime:VisualPart.RenderTransform>

	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="30"/>
			<RowDefinition/>
		</Grid.RowDefinitions>

		<Border Margin="2,2,2,2" Background="{DynamicResource VOColor11}" CornerRadius="1" Opacity="0.5"/>
		<StackPanel Orientation="Horizontal" Margin="7,0,7,0">
			<Button x:Name="btnOk" Style="{DynamicResource Button.TransparentWithEffect2}" Margin="5,0,0,0">
				<StackPanel Orientation="Horizontal">
					<wpf:Icon Source="/_images/PartSettings/ok.png" Width="18" Height="18"/>
					<TextBlock  Margin="5,0,0,0" Text="{x:Static properties:Globalization.SettingsPart_ExitAndApply}" VerticalAlignment="Center"/>
				</StackPanel>
			</Button>

			<Button x:Name="btnCancel" Style="{DynamicResource Button.TransparentWithEffect2}" Margin="5,0,0,0">
				<StackPanel Orientation="Horizontal">
					<wpf:Icon Source="/_images/PartSettings/cancel.png" Width="18" Height="18"/>
					<TextBlock Margin="5,0,0,0" Text="{x:Static globalProperties:Globalization.Cancel}" VerticalAlignment="Center"/>
				</StackPanel>
			</Button>
		</StackPanel>

		<TabControl x:Name="tabMain" Grid.Row="1" Style="{StaticResource SettingsTabControl}">
		</TabControl>

	</Grid>
</runtime:VisualPart>
